
var model = require("./model");

var student = (req, res, tch) => {
    var teach = "";
    switch (tch){
        case 1:
            teach = "吴振宇";
            break;
        case 2:
            teach = "范绍帅";
            break;
        case 3:
            teach = "聂高峰";
            break;
        case 4:
            teach = "王生楚";
            break;
        case 5:
            teach = "赵敏";
            break;
    }

    var document = new model({
        name1: req.body.name1,
        number1: req.body.number1,
        mark1: "",
        name2: req.body.name2,
        number2: req.body.number2,
        mark2: "",
        name3: req.body.name3,
        number3: req.body.number3,
        mark3: "",
        name4: req.body.name4,
        number4: req.body.number4,
        mark4: "",
        group: req.body.group,
        teacher: teach
    });

    document.save((err, resin) => {
        if (err){
            res.send("sign in error!!!");
        }else{
            res.send("sign in successfully!!!");
        }
    });
};

module.exports = student;